<template>
  <div class="config-box">
    <component :is="panelName"></component>
    <div class="bottom-btn">
      <span
        class="btn-item"
        :class="{ 'btn-active': activeBtn == 'ConfigMap' }"
        @click="changePanel('ConfigMap')"
        >基础数据配置</span
      >
      <span
        class="btn-item"
        :class="{ 'btn-active': activeBtn == 'ConfigGplot' }"
        @click="changePanel('ConfigGplot')"
        >计算资源配置</span
      >
    </div>
  </div>
</template>
<script setup>
import { markRaw, ref } from 'vue'
import ConfigMap from './cpns/base-data-config/index.vue'
import ConfigGplot from './cpns/count-resources-config/index.vue'
//控制按钮
const activeBtn = ref('configmap')
const panelName = ref(null)

//下方按钮点击触发面板切换
const changePanel = (val) => {
  activeBtn.value = val
  const lookup = {
    ConfigMap,
    ConfigGplot
  }
  panelName.value = markRaw(lookup[val])
}
//初始面板加载
changePanel('ConfigMap')
</script>
<style lang="less" scoped>
.config-box {
  width: 100%;
  height: 100%;
  position: relative;
  overflow: hidden;
  .map {
    position: relative;
    width: 100%;
    height: 100%;
    .map-container {
      background-color: white;
    }
  }
  .select-box {
    display: flex;
    flex-direction: column;
    width: 200px;
    height: auto;
    position: absolute;
    top: 50px;
    left: 30px;
    .marg-top {
      margin-top: 20px;
    }
    .header-select {
      width: 200px;
      margin-right: 20px;
    }
  }
  .select-basin {
    position: absolute;
    bottom: 40px;
    left: 20px;
    width: 210px;
    height: auto;
  }
  /* .bottom-btn {
    position: absolute;
    display: flex;
    justify-content: space-between;
    height: 40px;
    bottom: 30px;
    left: 35%;
    .btn-topology {
      margin-right: 30px;
      padding: 3px 20px;
      height: 30px;
      border: 1px solid rgba(22, 155, 213, 1);
      color: rgb(35, 9, 237);
      background-color: #ffffff;
      line-height: 30px;
      border-radius: 5px;
      text-align: center;
      cursor: pointer;
      &.active {
        background-color: rgba(22, 155, 213, 1);
        color: white;
      }
    }
  } */
}
.bottom-btn {
  height: 35px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: absolute;
  bottom: 30px;
  left: 45%;
  transform: translate(-45%, 0%);
  .btn-item {
    border: 1px solid rgba(22, 155, 213, 1);
    padding: 8px 30px;
    cursor: pointer;
    color: #00d3e9;
    border-radius: 4px;
  }
  .btn-active {
    background: rgba(22, 155, 213, 1);
    color: #fff;
  }
  .btn-item + .btn-item {
    margin-left: 25px;
  }
}
</style>
